<?php

declare(strict_types=1);

namespace app\common\service\sys;

use app\common\traits\ServiceTrait;
use app\common\dao\sys\LogDao;

/**
 * 系统日志
 * @author:kaige
 * @date:2022-06-12
 * @copyright ©2022 泉州市盛筑信息科技有限公司 版权所有
 */
class LogService
{
  protected $dao = null;

  public function __construct()
  {
    $this->dao = new LogDao();
  }
  use ServiceTrait;

  /**
   * 重写 列表搜索条件
   * @param $post
   * @return mixed
   */
  public function _list_where($post)
  {
    $where = [];
    if (isset($post['search_username']) && !empty($post['search_username'])) {
      $where[] = ['un', '=', $post['search_username']];
    }
    if (isset($post['search_ip']) && !empty($post['search_ip'])) {
      $where[] = ['ip', '=', $post['search_ip']];
    }
    if (isset($post['search_content']) && !empty($post['search_content'])) {
      $where[] = ['content', 'like', '%' . $post['search_content'] . '%'];
    }
    $result['where'] = $where;
    $result['field'] = [];
    $result['order'] = ['id' => 'desc'];
    return $result;
  }

  
}
